import 'dart:async';

class NearbyFoods {
  StreamController<List<Map>> _streamController;
  Stream<List<Map>> stream;
  NearbyFoods() {
    _streamController = StreamController.broadcast();
    stream = _streamController.stream;
    loadMore();
  }

  List<Map> _data = [];

  loadMore() {
    Future.delayed(Duration(seconds: 1)).then((value) {
      _data.addAll(List.generate(6, (index) => {...nearbyFoodListData[index], 'image':nearbyFoodListImages[index]}));
      _streamController.add(_data);
    });
  }
}

const List<String> nearbyFoodListImages = [
  'http://p1.meituan.net/158.0.80/waimaipoi/7c28ef8b2e0b713d744bb47531fdb751730810.jpg',
  'http://p1.meituan.net/158.0.80/waimaipoi/2ab72d7e0da439aabf72eb0af95b9fbd72624.jpg',
  'http://p1.meituan.net/158.0.80/waimaipoi/adf54581bba7095a1c166481eba4245a42920.jpg',
  'http://p1.meituan.net/158.0.80/waimaipoi/bb937d469c2cb7f44ca572797f295fbb35261.jpg',
  'http://p1.meituan.net/158.0.80/waimaipoi/6858a04c33ab1f651fa8c4005cc6798d35466.jpg',
  'http://p1.meituan.net/158.0.80/waimaipoi/0e024a67bf6d6b3076ca5aa4e559abe730478.jpg',
  'http://p0.meituan.net/158.0.80/waimaipoi/5e108332432227ae60b652f03e889936196121.jpg',
  'http://p0.meituan.net/158.0.80/waimaipoi/1db3078b6984928c4a66d392e1694c39200704.jpg',
  'http://p0.meituan.net/158.0.80/waimaipoi/bf22be93f468393abd6c589e0cedd725313072.jpg',
  'http://p0.meituan.net/158.0.80/waimaipoi/89086f421993ac2baaabbfd07641439458178.jpg',
  'http://p0.meituan.net/158.0.80/waimaipoi/378c1365968a4485f752e9f32be99ffb410205.jpg',
];

const List<Map> nearbyFoodListData = [
  {
    'title': '正宗一品香朝天锅',
    'star': '4.9',
    'sales': '994',
    'startPrice': '15',
    'courierPrice': '4',
    'comment': '香辣肉味道纯正',
    'time': '30',
    'distance': '2.6',
    'promotions': [
      '6元无门槛红包',
      '5.83折起',
      '首单减19',
    ],
    'badge': '',
  },
  {
    'title': '兰州牛肉拉面',
    'star': '4.6',
    'sales': '732',
    'startPrice': '15',
    'courierPrice': '4',
    'comment': '量大，好吃',
    'time': '30',
    'distance': '2.0',
    'promotions': [
      '40减2',
      '70减3'
    ],
    'badge': '',
  },
  {
    'title': '千禧缘超市',
    'star': '4.9',
    'sales': '1746',
    'startPrice': '15',
    'courierPrice': '4',
    'comment': '',
    'time': '35',
    'distance': '3.2',
    'promotions': [
      '9折起',
      '领10元商品券',
      '领3元商品券'
    ],
    'badge': '',
  },
  {
    'title': '东坡把子肉',
    'star': '4.9',
    'sales': '499',
    'startPrice': '15',
    'courierPrice': '4',
    'comment': '经常点，棒棒棒',
    'time': '35',
    'distance': '3.3',
    'promotions': [
      '满30得赠品',
      '首单减19',
    ],
    'badge': '',
  },
  {
    'title': '国胜饭店',
    'star': '4.3',
    'sales': '10',
    'startPrice': '15',
    'courierPrice': '4',
    'comment': '其他地方菜',
    'time': '45',
    'distance': '2.2',
    'promotions': ['首单减19', '放心吃'],
    'badge': '',
  },
  {
    'title': '河间府河间驴肉火烧',
    'star': '4.8',
    'sales': '803',
    'startPrice': '15',
    'courierPrice': '2',
    'comment': '相当好吃，肉多实惠',
    'time': '35',
    'distance': '3.2',
    'promotions': [
      '25减15',
      '35减20',
      '8.57折起',
    ],
    'badge': '',
  },
];
